import 'package:boss/common/common.dart';
import 'package:boss/ui/page/booking/bookingHistory/booking_history_page.dart';
import 'package:boss/ui/page/commission/commission_page.dart';
import 'package:boss/ui/page/commodity/bindingCommodity/binding_commodity_page.dart';
import 'package:boss/ui/page/commodity/categories/categories_page.dart';
import 'package:boss/ui/page/commodity/classificationManagement/classification_management_page.dart';
import 'package:boss/ui/page/commodity/material/material_page.dart';
import 'package:boss/ui/page/costManagement/cost_management_page.dart';
import 'package:boss/ui/page/machineSetup/machine_setup.dart';
import 'package:boss/ui/page/marketing/coupon/couponList/coupon_list_page.dart';
import 'package:boss/ui/page/member/page/gradeDiscount.dart';
import 'package:boss/ui/page/member/page/memberAdministration.dart';
import 'package:boss/ui/page/member/page/rechargeRule.dart';
import 'package:boss/ui/page/miniProgram/miniProgramIndex/mini_program_index_page.dart';
import 'package:boss/ui/page/modulePage/model/module_data.dart';
import 'package:boss/ui/page/modulePage/widget/module_grid.dart';
import 'package:boss/ui/page/necessaryOrder/necessary_order_page.dart';
import 'package:boss/ui/page/offersManagement/offers_management_page.dart';
import 'package:boss/ui/page/packageGroup/package_group_page.dart';
import 'package:boss/ui/page/pay/payHome/pay_home_page.dart';
import 'package:boss/ui/page/printer/printer_page.dart';
import 'package:boss/ui/page/role/role_page.dart';
import 'package:boss/ui/page/staff/staff_page.dart';
import 'package:boss/ui/page/staffGratuity/gratuity_page.dart';
import 'package:boss/ui/page/storeEvaluate/storeEvaluate.dart';
import 'package:boss/ui/page/tableManagement/table_management_page.dart';
import 'package:boss/ui/page/takeoutManagement/page/businessSetting/business_setting_page.dart';
import 'package:boss/ui/page/takeoutManagement/page/deliveryFeeSetting/delivery_fee_setting_page.dart';
import 'package:boss/ui/page/takeoutManagement/page/fullDecrementSetUp/full_decrement.dart';
import 'package:boss/ui/page/takeoutManagement/page/packagingFeeSetting/packaging_fee_setting_page.dart';
import 'package:boss/ui/page/takeoutManagement/page/takeoutList/takeout_list_page.dart';
import 'package:boss/ui/page/viceScreen/vice_screen_page.dart';
import 'package:flutter/material.dart';
import 'package:hi_common/hi_common.dart';

class ModuleBrowser extends StatelessWidget {
  final List<ModuleData> data = [
    ModuleData(title: '菜品', data: [
      Module(title: '我的菜单', icon: 'assets/image/commodity_menu_icon.png', url: CategoriesPage.pageName),
      Module(title: '分类管理', icon: 'assets/image/classfication_icon.png', url: ClassificationManagementPage.pageName),
      Module(title: '套餐分组', icon: 'assets/image/package_group_icon.png', url: PackageGroupPage.pageName),
      Module(title: '加料配菜', icon: 'assets/image/material_management_icon.png', url: MaterialManagerPage.pageName),
    ]),
    ModuleData(title: '门店', data: [
      Module(title: '桌台管理', icon: 'assets/image/table_management_icon.png', url: TableManagementPage.pageName),
      Module(title: '开台必点', icon: 'assets/image/must_order_icon.png', url: NecessaryOrderPage.pageName),
      Module(title: '移动支付', icon: 'assets/image/moble_pay.png', url: PayHomePage.pageName),
      Module(title: '扫码点餐', icon: 'assets/image/scan_order_icon.png', url: MiniProgramIndexPage.pageName),
      Module(title: '优惠管理', icon: 'assets/image/offer_management_icon.png', url: OffersManagementPage.pageName),
      Module(title: '小费设置', icon: 'assets/image/tip_fee_setting_icon.png', url: GratuityPage.pageName),
      Module(title: '成本管理', icon: 'assets/image/cost_icon.png', url: CostManagementPage.pageName),
      Module(title: '门店评价', icon: 'assets/image/store_evaluation_icon.png', url: StoreEvaluate.pageName),
      Module(title: '提成管理', icon: 'assets/image/commission_management_icon.png', url: CommissionPage.pageName),
      Module(title: '收银设置', icon: 'assets/image/store_settings.png', url: MachineSetup.pageName),
      Module(title: '双屏设置', icon: 'assets/image/store_settings.png', url: ViceScreenPage.pageName),
      Module(title: '云打印机设置', icon: 'assets/image/printer_setting_icon.png', url: PrinterPage.pageName),
    ]),
    ModuleData(title: '会员', data: [
      Module(title: '会员管理', icon: 'assets/image/member_management_icon.png', url: MemberAdministration.pageName),
      Module(title: '等级优惠', icon: 'assets/image/memeber_level_offer_icon.png', url: GradeDiscount.pageName),
      Module(title: '充/消规则', icon: 'assets/image/top_up_consumption_icon.png', url: RechargeRule.pageName),
    ]),
    ModuleData(title: '员工', data: [
      Module(title: '员工信息', icon: 'assets/image/staff_message_icon.png', url: StaffPage.pageName),
      Module(title: '角色管理', icon: 'assets/image/staff_rank_icon.png', url: RolePage.pageName),
    ]),
    ModuleData(title: '营销活动', data: [
      Module(title: '优惠券管理', icon: 'assets/image/coupons_icon.png', url: CouponListPage.pageName),
      // Module(title: '营销效果', icon: 'assets/image/marketing_icon.png', url: MarketingAnalysisPage.pageName),
    ]),
    ModuleData(title: '外卖', data: [
      Module(title: '外卖设置', icon: 'assets/image/takeout_setting_icon.png', url: BusinessSettingPage.pageName),
      Module(title: '配送费设置', icon: 'assets/image/shipping_fee_icon.png', url: DeliveryFeeSettingPage.pageName),
      Module(title: '包装费设置', icon: 'assets/image/package_fee_icon.png', url: PackagingFeeSettingPage.pageName),
      Module(title: '分类管理', icon: 'assets/image/takeout_classification.png', url: ClassificationManagementPage.pageName),
      Module(title: '商品管理', icon: 'assets/image/takeout_commodity_icon.png', url: CategoriesPage.pageName),
      Module(title: '套餐分组', icon: 'assets/image/package_group_icon.png', url: PackageGroupPage.pageName),
      Module(title: '外卖明细', icon: 'assets/image/takeout_detail_icon.png', url: TakeoutListPage.pageName),
      Module(title: '关联菜品', icon: 'assets/image/bind_icon.png', url: BindingCommodityPage.pageName),
      Module(title: '满减设置', icon: 'assets/image/takeout_decrement_icon.png', url: FullDecrementPage.pageName),
    ]),
    ModuleData(title: '预订', data: [
      Module(title: '预定信息', icon: 'assets/image/book_icon.png', url: BookingHistoryPage.pageName),
    ]),
  ];

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      padding: EdgeInsets.symmetric(horizontal: 30.w),
      child: Column(
          children: data
              .map((item) => ModuleGrid(
                    item,
                    onItemTap: (data) {
                      Constant.commodityType = data.title == '外卖' ? CommodityType.takeout : CommodityType.tang;

                      Navigator.pushNamed(context, data.url);
                    },
                  ))
              .toList()),
    );
  }
}
